Conventionally, there are known image generating systems for generating an image viewed from a given viewpoint in a three-dimensional virtual space. Such systems are conventionally used in game apparatuses. Some of the systems generate a realistic image in order to improve artificial reality of a virtual space. Further, some of the systems generate animated cartoon cell picture-like images in order to represent the virtual space in the manner of an animated cartoon. In such systems, an object in the virtual space is distinctly (i.e., clearly) shaded, thereby generating a cartoon-like image.
One conventional technology for generating the cartoon-like image uses a so-called toon shading technique. FIG. 12 is a diagram illustrating an exemplary display of an image generated by the conventional technology using toon shading. A general process of generating an image using toon shading is described below with reference to FIG. 12. In this process, brightness information is initially added to an object in a virtual space based on a prescribed condition. For example, the brightness information is added by irradiating the object with a light beam from a virtual light (light source) 91 provided at a point in the virtual space. Then, the object is divided into a plurality of portions in accordance with the brightness information. For example, consider a case of dividing the object into two grades (two areas). The object is divided into a bright area 92 and a dark area 93 in accordance with brightness provided by the virtual light 91. Finally, color values are set differently between the bright area 92 and the dark are 93, thereby representing the object using the color values of two grades. In this manner, the conventional technology generates a cartoon-like image in gradual shades.
In some cases, a game apparatus or a game system shades the object in accordance with a special effect generated in a game space. For example, the object is shaded so as to be viewed as if it is illuminated by lightning or explosion, as well as by a normal light beam provided in the game space. Also, there may be a case where the object is shaded so as to be viewed as if it is illuminated by light beams from two or more places without using a light beam provided as a special effect, e.g., lightning or explosion.
In the above-described conventional technology, however, the state of the object illuminated by the light beams from two or more places cannot be represented using toon shading. This is because the brightness information used with toon shading in the conventional technology is defined by a prescribed condition (e.g., the virtual light 91 as described above), and therefore the brightness information cannot be used for representing a light beam (e.g., a light beam provided as a special effect) different from the normal light beam. Specifically, in the example of FIG. 12, the brightness information is defined by the light beam illuminating the object from the position of the virtual light 91, and therefore even if the brightness information is used, the state of the object illuminated by a light beam from a position other than the position of the virtual light 91 cannot be represented.
Accordingly, in the conventional technology, the state of the object illuminated by the light beam provided as a special effect is represented by shading the object without using toon shading, or such a state is represented without shading the object. As a result, in the conventional technology, the object to be represented as a cartoon-like object is realistically shaded, or the object is not shaded at all. Therefore, the state of the object illuminated by the light beams from two or more places, typically, as in the case where the light beam provided as a special effect is used, cannot be satisfactorily represented using toon shading, resulting in an unnatural image. In order to shade the object so as to be viewed as if it is illuminated by the light beams from two or more places, an extra process is required in addition to toon shading, leading to an increase in the number of processes for image generation. Thus, in some cases, the above-described conventional technology cannot be used in a game apparatus or the like which requires real-time image generation.
Therefore, a feature of the illustrative embodiments is to provide a game apparatus and game program capable of representing the state of an object illuminated by light beams from two or more places using the toon shading.
The illustrative embodiments have the following features to attain the feature mentioned above. It should be noted that reference numerals and supplemental remarks in brackets are provided in the following description in order to indicate correspondence with embodiments, which will be described for facilitating easy understanding of the illustrative embodiments, rather than to limit the scope of the present invention.
A first aspect of the illustrative embodiments is directed to a game apparatus (a game apparatus 101) for displaying an object in a game space. The game apparatus includes: a light source setting section (a CPU 202 and/or a GPU 204 implementing steps S12 and S14; hereinafter, only step numbers are shown); a brightness calculating section (a brightness calculating section 521 and a texture coordinate generating section 522, S21 and S22); a threshold value storage section (a threshold value data storage region 205e); a region determining section (a texture color determining section 523, S23 through S29); and a display color determining section (a display color determining section 524, S30). The light source setting section sets, in the game space, n light sources (a normal light 64 and an effect light 65) (where n is an integer equal to or more than 2) for irradiating the object with a light beam. The brightness calculating section calculates, for each of the predetermined units forming the object, a brightness vector having as components n illumination intensities (first and second illumination intensities) respectively added by the n light sources. The threshold value storage section has threshold values of the n illumination intensities (first and second threshold values) stored therein. The threshold values are used for dividing a coordinate region for the brightness vector into at least three regions (first through fourth regions). The region determining section determines, for each of the predetermined units, a region including a tip of the brightness vector calculated by the brightness calculating section from among the regions obtained via division by the threshold values based on relationships in size between the n illumination intensities and their corresponding threshold values. The display color determining section determines a display color for each of the predetermined units based on the region determined for each of the predetermined units by the region determining section, such that the object's display color distinctly varies.
As described above, in the first aspect, n types of illumination intensities added by the n light sources are calculated. Toon shading is performed using an n-dimensional brightness vector having the n types of illumination intensities as components, and a coordinate region and threshold value of the brightness vector, and the display color of each of the predetermined units forming the object is determined. In this manner, the brightness added by the n light sources is represented using the n-dimensional vector and the coordinate region, whereby it is possible to separately represent the influence of n different light beams on each of the predetermined units. Moreover, since toon shading is performed using the n-dimensional vector and the coordinate region, and then the object's display color is determined, it is possible to determine, for each of the predetermined units, the display color on which the influence of the n different light beams are reflected. Thus, it is possible to represent the state of the object illuminated by the n different light beams using toon shading.
Alternatively, in the first apparatus, the light source setting section may set a first light source (a first light (the normal light 64)) emitting a light beam of a first color (red), and a second light source (a second light (the effect light 65)) emitting a light beam of a second color (green) which is different from the first color. The brightness calculating section may calculate, for each of the predetermined units forming the object, a brightness vector composed of the illumination intensities corresponding to values of color components of the first and second colors. The region determining section may determine the region including the tip of the brightness vector by determining a relationship in size between the value of the color component of the first color and its corresponding first threshold value, and a relationship in size between the value of the color component of the second color and its corresponding second threshold value.
Accordingly, each illumination intensity is calculated based on a corresponding one of the values of color components of the first and second colors, and therefore when calculating an illumination intensity added by one of the first and second light sources, it is not necessary to consider the influence of the other light source. That is, each illumination intensity is calculated based on a value of a different color component, and therefore can be separately calculated. Thus, it is possible to simultaneously set the two light sources and calculate the illumination intensities added by the two light sources. Moreover, it is possible to accurately calculate an illumination intensity added by one of the two light sources without being influenced by the other light source.
Alternatively, still, in the first aspect, the first color may be either one of red, green, or blue. In this case, the second color differs from the first color, and is either one of red, green, or blue.
Thus, it is possible to represent the illumination intensities using each component value of color data represented by RGB values.
Alternatively still, in the first aspect, the coordinate region may be divided into different regions by the first threshold value, and may further be divided into different regions by the second threshold value. In this case, the display color determining section determines display colors of different brightness in accordance with the regions obtained by division by the first threshold value, and determines display colors of different types in accordance with the regions obtained by division by the second threshold value.
Accordingly, the brightness of the display color of each of predetermined units varies in accordance with the illumination intensity added by the first light source. Also, the brightness of the display color of each of the predetermined units varies in accordance with the illumination intensity added by the second light source. Thus, the first and second light sources can be used for representing shades due to light beams of different types.
Alternatively still, in the first aspect, the display color determining section may determine, in accordance with the regions obtained by division by the second threshold value, either a color used for representing an object influenced by a special effect generated in the game space or a color used for representing an object in the case where no special effects are generated.
Thus, the second light source can be used for representing shades due to a light beam provided as the special effect. The special effect as described herein refers to lightning or explosion generated in the game space.
Alternatively still, in the first aspect, the game apparatus may further include a special effect determining section (S13). The special effect determining section determines whether the special effect is generated in the game space. The light source setting section provides the second light source only when the special effect determining section determines that the special effect has been generated.
Accordingly, it is possible to irradiate the object with the light beam provided as the special effect when necessary, i.e., only when the special effect is generated. Thus, it is possible to represent the state of the object illuminated by the special effect which is temporarily generated.
Alternatively still, in the first aspect, the game apparatus may further include a display color storage section (a basic display color data storage region 205d). The display color storage section has basic display colors stored therein. The basic display colors are used for determining the display color of each object. In this case, the display color determining section determines the display color based on the region determined by the region determining section and the basic display colors stored in the display color storage section.
Alternatively, still, in the first aspect, the region determining section may represent a determined region by a numerical value. The display color determining section may determine the display color by performing a predetermined calculation using the numerical value representing the region determined by the region determining section and color data for the basic display colors.
Accordingly, it is possible to determine the display color by performing the predetermined calculation, and therefore it is not necessary to prepare a table in which the region determined by the region determining section is associated with the basic display colors, for example. Thus, it is possible to conserve a storage region of the game apparatus.
A second aspect of the illustrative embodiments is directed to a game apparatus for displaying an object in a game space. The apparatus includes: a first light source setting section (S12); a second light source setting section (S14); a brightness calculating section (the brightness calculating section 521 and the texture coordinate generating section 522, S21 and S22); a threshold value storage section (the threshold value data storage region 205e); a first detecting section (the texture color determining section 523, S23); a second detecting section (the texture color determining section 523, S24 and S25); and a display color determining section (the display color determining section 524, S30). The first light source setting section sets, in the game space, a first light source (the normal light 64) for irradiating the object with a light beam. The second light source setting section sets, in the game space, a second light source (the effect light 65) which is different from the first light source. The brightness calculating section calculates, for each of predetermined units forming the object, a first illumination intensity added by the first light source and a second illumination intensity added by the second light source. The threshold value storage section has threshold values of the first and second illumination intensities stored therein. The first detecting section detects, for each of the predetermined units, a relationship in size between the first illumination intensity and its corresponding threshold value. The second detecting section detects, for each of the predetermined units, a relationship in size between the second illumination intensity and its corresponding threshold value. The display color determining section determines a display color for each of the predetermined units based on detection results obtained for each of the predetermined units by the first and second detecting sections, such that the object's display color distinctly varies.
As described above, in the second aspect, two types of illumination intensities added by the two light sources are calculated. Toon shading is performed using the illumination intensities and the threshold values, and the display color of each of the predetermined units forming the object is determined. In this manner, the brightness added by the two light sources is represented using the two types of illumination intensities, whereby it is possible to separately represent the influence of two different light beams on each of the predetermined units. Moreover, since toon shading is performed using the two illumination intensities, and then the object's display color is determined, it is possible to determine, for each of the predetermined units, the display color on which the influence of the two different light beams are reflected. Thus, it is possible to represent the state of the object illuminated by the two different light beams using toon shading.
In the first and second aspects, the predetermined units are typically polygons forming the object.
A third aspect of the illustrative embodiments is directed to a computer-readable recording medium having a game program recorded therein. The game program causes a game apparatus to implement functions achieved by the first aspect.
A fourth aspect of the illustrative embodiments is directed to a computer-readable recording medium having a game program recorded therein. The game program causes a game apparatus to implement functions achieved by the second aspect.
These and other features, aspects and advantages of the illustrative embodiments will become more apparent from the following detailed description of the illustrative embodiments when taken in conjunction with the accompanying drawings.